<script>
import { useUserStore } from './store/userStore';
import { usePostStore } from './store/postStore';
import { useFacilityStore } from './store/facilityStore';

export default {
  onLaunch: function() {
    console.log('App Launch');
    
    // 初始化各存储
    const userStore = useUserStore();
    const postStore = usePostStore();
    const facilityStore = useFacilityStore();
    
    // 加载用户数据
    userStore.loadUserInfoFromStorage();
    userStore.loadSettingsFromStorage();
    
    // 加载帖子数据
    postStore.loadPostsFromStorage();
    
    // 加载设施数据
    facilityStore.loadFacilitiesFromStorage();
  },
  onShow: function() {
    console.log('App Show');
  },
  onHide: function() {
    console.log('App Hide');
  }
};
</script>

<style>
/* 全局样式 */
@import url("./static/css/reset.css");

page {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: #f7f8fa;
  color: #333;
  font-size: 28rpx;
  box-sizing: border-box;
}

/* 常用颜色 */
.primary-color {
  color: #3F7BFC;
}

.primary-bg {
  background-color: #3F7BFC;
}

.success-color {
  color: #52c41a;
}

.warning-color {
  color: #faad14;
}

.danger-color {
  color: #ff5252;
}

/* 常用圆角 */
.radius-sm {
  border-radius: 6rpx;
}

.radius-md {
  border-radius: 12rpx;
}

.radius-lg {
  border-radius: 24rpx;
}

/* 阴影 */
.shadow-sm {
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}

.shadow-md {
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
}

.shadow-lg {
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
}

/* 文本溢出省略 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 按钮样式 */
button {
  padding: 0;
  margin: 0;
  background-color: transparent;
  line-height: normal;
}

button::after {
  border: none;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 20rpx 40rpx;
  border-radius: 10rpx;
  font-size: 28rpx;
}

.btn-primary {
  background-color: #3F7BFC;
  color: #fff;
}

.btn-outline {
  border: 1px solid #3F7BFC;
  color: #3F7BFC;
}

.btn-danger {
  background-color: #ff5252;
  color: #fff;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  page {
    background-color: #121212;
    color: #f5f5f5;
  }
  
  /* 调整其他暗色主题样式 */
}
</style>
